package com.foreknow.demo16;

/**
 * 实现多线程方式
 * 1.继承Thread类
 */
public class MyThread extends Thread {

    @Override
    public void run() {
        for (int i = 0;i<1000;i++){
            System.out.println("子线程运行了"+i);
        }
    }

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start(); //start()表示启动线程


        for (int i = 0;i<1000;i++){
            System.out.println("主线程运行了"+i);
        }

    }
}
